﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CLEXA.ClientTools.Collections;
using CLEXA.DataContracts;
using CLEXA.ServiceContracts;
using CLEXA.SurfaceClient.Cache;
using Windows.UI.Xaml.Controls.Primitives;

namespace CLEXA.SurfaceClient.Functions
{
    public class DatabaseNew : IDatabaseNew
    {
        private readonly IDatabaseCache databaseCache;
        private readonly Popup popup;

        public IReadOnlyObservableDictionary<int, DatabaseData> Databases
        {
            get { return databaseCache.Databases; }
        }

        public DatabaseNew(IDatabaseCache databaseCache, Popup popup)
        {
            this.databaseCache = databaseCache;
            this.popup = popup;
        }

        public void ClosePopUp()
        {
            popup.IsOpen = false;
        }

        public int CreateDatabase(int userId, string connectionString)
        {
            return databaseCache.CreateDatabase(userId, connectionString);
        }
    }
}
